<?php
/*
 * @Author: zwx
 * @Date: 2024-05-12 10:56:51
 * @LastEditors: zwx
 * @LastEditTime: 2024-05-25 10:57:19
 * @Description: 私域直播    -订单列表
 */

 namespace app\apiadmin\controller\live;
 use think\facade\Db;
 use app\common\utils\Res;
 use app\common\controller\BaseController;
use app\Request;
use Exception;

use PhpOffice\PhpSpreadsheet\IOFactory;
use think\exception\ValidateException;

use app\apiadmin\service\order\OrderService;

 class Order extends BaseController
 {

    /**
     * @author: zwx
     * @Description: 获取订单列表数据
     * @Date: 2024-05-12 11:00:52
     */    
    public function getOrderData(){

        $param = $this->request->post();
        $result = OrderService::getlist($param);
        return $result;

    }

    /**
     * @author: zwx
     * @Description: 申请退款
     * @Date: 2024-05-25 10:55:44
     */    
    public function tuikuan(){
        $param = $this->request->post();
//        dd($param);
        if(empty($param['amount'])){
            return Res::error('退款金额不能为空');
            die;
        }  
        if($param['amount'] < 0){
            return Res::error('退款金额不能为负数');
        }
        if(empty($param['reason'])){
            return Res::error('退款原因不能为空');
            die;
        }
        $result = OrderService::tuikuan($param);
        return $result;
    }

 }